package cn.signalpha.modules.shop.service;

import cn.signalpha.modules.shop.entity.OrderCoupon;
import cn.signalpha.modules.shop.mapper.OrderCouponMapper;
import cn.signalpha.modules.shop.vo.OrderCouponVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 服务类
 *
 * @author signalpha
 */
@Service
public class OrderCouponService extends ServiceImpl<OrderCouponMapper, OrderCoupon> {

	/**
	 * 自定义分页
	 */
    public IPage<OrderCouponVO> selectOrderCouponPage(IPage<OrderCouponVO> page, Map<String, Object> params) {
        return page.setRecords(baseMapper.selectOrderCouponPage(page, params));
    }

	/**
	 * 订单号搜索
	 */
    public List<OrderCoupon> listByOrderNo(String orderNo) {
		return baseMapper.selectList(Wrappers.<OrderCoupon>lambdaQuery().like(OrderCoupon::getOrderNo, orderNo));
    }
}

